Choosing the Right Load Balancer
Introduction to load balancers in GCP.
We'll cover the following
In the last lesson, we looked at the essential part of the Google Cloud, “VPC networking”. VPC is a mandatory component so, it is involved in every use case.
In this lesson, we will look at the next component of the Networking ecosystem, the “load balancer”. Cloud load balancing is the process of distributing workloads across multiple computing resources.
Introduction#
Cloud load balancing maximizes the availability of resources by routing traffic to appropriate healthy instances and also helps in monitoring the uptime of the service. The load balancer provides a single point of contact for a cluster of resources.
Goole Cloud provides different types of load balancing services based on the traffic you want to serve. You might have come across a load balancer while working with GKE. A load balancer needs a backend to distribute traffic which is served by the backend. We will look at the high-level overview of the load balancers.
Types of load balancers#
-
Open
Main menu > Networking > Network services > Load balancing. -
Click on the Create a load balancer button.
You will see the available types of load balancers from which you can select the one depending upon the layer at which you want to distribute traffic.
The available types of load balancers are:
- HTTPS Load Balancer.
- TCP Load Balancer.
- UDP Load Balancer.
Let’s see each one in detail.
HTTPS load balancing#
HTTPS is at layer 7 in the OSI model. Hence it is called layer 7 load balancing. HTTPS load balancing provides 2 options based on the origin of the incoming traffic to your VM instance.
-
External HTTPS traffic: If the traffic is coming from the internet to your VM instance using an IP address, you will use an external HTTPS load balancer.
-
Internal HTTPS traffic: If the traffic is from internal VMs to other internal VM you will use the internal HTTPS load balancer.
TCP load balancing#
TCP comes at layer 4. It is a layer 4 load balancing or proxy for applications that rely on TCP/SSL protocol. It can provide regional or multi-regional load balancing for the backends present in one or multiple regions. You can configure multiple options with TCP load balancing depending upon the requirements and type of traffic.
If you need SSL offload or TCP proxy you can configure that also using TCP load balancing. Google has created a decision chart to select the appropriate load balancing service for the specific use case. We will look at that at the end of this lesson.
UDP load balancing#
Then comes the layer 4 UDP load balancer for the applications that rely on the UDP protocol. Again depending upon the origin you can select the internal or external load balancer option.
Let’s look at the decision tree created by Google to see which load balancer service and configuration will be best suited depending upon the requirement.
Except for external TCP traffic, other options are straightforward.
-
So, for external TCP traffic if you need “SSL Offload” then choose the “SSL Proxy” configuration.
-
If you don’t need SSL Offload but need to support global traffic or IPv6 then choose “TCP proxy.”
-
If you don’t need SSL Offload and you are supporting only IPv4 then depending upon the client IP preservation, if you need to preserve client IP then choose “TCP proxy” and if not then you can use “Network TCP Load balancing”.
Go through the chart 2-3 times so that you can easily tell which load balancer to choose for what situation. Usually, questions are based on this diagram only.
In the next lesson, we will look at the last network service which comes under the scope of this course. We will look at the Cloud DNS. It is a pretty straight forward service and it is not much different from other normal DNS services. So, let’s wrap up the Cloud DNS quickly.
Virtual Private Cloud (VPC)
Cloud DNS